#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int Digit(int n)
{
	int count = 0;
	while (n)
	{
		count++;
		n /= 10;
	}
	return count;
}
int shuixian(int n)
{
	int i, j;
	int l = Digit(n);
	int a[10000] = { 0 };
	int t = n;
	for (i = 0; i < l; i++)
	{
		a[i] = t % 10;
		t /= 10;
	}
	int sum = 0;
	for (i = 0; i < l; i++)
	{
		int mid = 1;
		for (j = 1; j <= l; j++)
			mid *= a[i];
		sum += mid;
	}
	if (sum == n)
		return 1;
	else
		return 0;
}
int main()
{
	long i;
	for (i = 0; i < 100000; i++)
		if (shuixian(i))
			printf("%d ", i);
	return 0;
}